<%@ page language="java" contentType="text/html; charset=UTF-8" pageEncoding="UTF-8"%>
<%@ page import="sealte.hvpms.pojo.*,java.sql.Date" %>
<%
String path = request.getContextPath();
String basePath = request.getScheme()+"://"+request.getServerName()+":"+request.getServerPort()+path+"/";
%>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<%
	UserCreate uc = (UserCreate)session.getAttribute("UserCreate");
	if(uc!=null){
		String vp_title = request.getParameter("vp_title");
		String vp_descriptions = request.getParameter("vp_descriptions");
		String vp_options_str = request.getParameter("vp_options");
		String vp_maxanswers_str = request.getParameter("vp_maxanswers");
		String vp_enddate = request.getParameter("vp_enddate");
		String vp_rule_str = request.getParameter("vp_rule");
		Poll poll = new Poll();
		poll.setName(vp_title);
		poll.setDescriptions(vp_descriptions);
		int vp_options = Integer.parseInt(vp_options_str);
		poll.setOptions(vp_options);
		poll.setMaxanswers(Integer.parseInt(vp_maxanswers_str));
		poll.setEnddate(Date.valueOf(vp_enddate));
		poll.setRule_int(Integer.parseInt(vp_rule_str));
		poll.setBuilder(uc.getId());
		session.setAttribute("vp_add1",poll);
%>
<html>
<head>
<base href="<%=basePath%>"/>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<title>仓鼠网上投票系统HVPMS</title>
<link type="text/css" rel="stylesheet" href="css/vp_add2.jsp.css" />
<script src="js/jquery-1.4.4.min.js" type="text/javascript"></script>
<script src="js/vp.add.step2.js" type="text/javascript"></script>
</head>
<body>
<div id="num2">
<h2><img src="images/page.png">&nbsp;投票信息管理--新增&nbsp;&nbsp;[2/2]&nbsp;&nbsp;投票-选项信息</h2>
</div>
<div id="num1">
<form action="VPAdd" method="POST" enctype="multipart/form-data" id="vp_add2_form">
<table width="70%">
<tr>
	<th width="3%">序号</th><th width="32%">内容<span>[必填]</span></th><th width="32%">图片</th><th width="32%">链接</th>
</tr>
<%
	for(int i=1;i<=vp_options;i++){
%>
<tr id="main_tr" onmouseover=sbar(this) onmouseout=cbar(this)>
	<td valign="top"><%=i %></td>
	<td><input type="text" size="45" name="<%="content"+String.valueOf(i) %>" id="option_content"></td>
	<td><input type="file" size="36" name="<%="image"+String.valueOf(i) %>" id="option_image" value=""></td>
	<td><input type="text" size="45" name="<%="link"+String.valueOf(i) %>" id="option_link" value=""></td>
</tr>
<%
	}
%>
<tr>
	<td colspan="4" align="right">
	<input type="button" value="&lt;&lt;上一步" onclick="prevStep()"/>&nbsp;
	<input type="button" value="生成投票" onclick="validateToSubmit()"/>
	</td>
</tr>
</table>
</form>
</div>
</body>
</html>
<%		
	}else{
		out.println("谢绝跨路径访问！");
	}
%>